package light.network;

import java.nio.ByteBuffer;

public interface Packet {

	ByteData data();
	
	/**
	 * 数据包净长度（不包括任何冗余信息）
	 * @return
	 */
	public abstract int getLength();

	public abstract boolean validate();

	public abstract ByteBuffer buffer();

	public abstract byte[] array();

	public abstract int capacity();

	public abstract Packet clear();

	public abstract Packet flip();

	public abstract byte get();

	public abstract byte get(int index);

	public abstract char getChar();

	public abstract char getChar(int index);

	public abstract double getDouble();

	public abstract double getDouble(int index);

	public abstract float getFloat();

	public abstract float getFloat(int index);

	public abstract int getInt();

	public abstract int getInt(int index);

	public abstract long getLong();

	public abstract long getLong(int index);

	public abstract short getShort();

	public abstract short getShort(int index);

	public abstract int limit();

	public abstract Packet limit(int newLimit);

	public abstract int position();

	public abstract Packet position(int newPosition);

	public abstract Packet put(byte b);

	public abstract Packet put(byte[] src, int offset, int length);

	public abstract Packet put(byte[] src);

	public abstract Packet put(ByteBuffer src);

	public abstract Packet put(int index, byte b);

	public abstract Packet putChar(char value);

	public abstract Packet putChar(int index, char value);

	public abstract Packet putDouble(double value);

	public abstract Packet putDouble(int index, double value);

	public abstract Packet putFloat(float value);

	public abstract Packet putFloat(int index, float value);

	public abstract Packet putInt(int index, int value);

	public abstract Packet putInt(int value);

	public abstract Packet putLong(int index, long value);

	public abstract Packet putLong(long value);

	public abstract Packet putShort(int index, short value);

	public abstract Packet putShort(short value);

	//public abstract String toString(String encoder) throws UnsupportedEncodingException;

}
